/*
 * ImageLoader.java
 *
 * Created on 25 de septiembre de 2006, 12:49 PM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package inc.jmc.cyberboard.common;
import javax.swing.*;

/**
 *
 * @author  Juan Miguel Olguin Salguero
 */
public class ImageLoader {

    public static final int COMPUTER_ICON_FRAME=0;
    public static final int PC_DISPONIBLE=1;
    public static final int PC_FUERA_DE_SERVICIO=2;
    public static final int PC_OCUPADA=3;
    public static final int PC_APAGADA=4;
    public static final int PC_ICONIFICADA=5;
    public static final int PESOS_ICON=6;
    public static final int JPG_FILTER=7;
    public static final int GIF_FILTER=8;
    public static final int CARATULA_RELOJ=9;
    public static final int MAIN_COVER=10;
    public static final int BUTTON_START=11;
    public static final int BUTTON_STOP=12;
    public static final int VISTA_TABLA=13;
    public static final int VISTA_LISTA=14;
    public static final int VISTA_ICONOS=15;
    public static final int JPG_FILTER2=16;
    public static final int BACKGROUND1=17;
    public static final int BACKGROUND2=18;
    public static final int BACKGROUND3=19;
    public static final int BACKGROUND4=20;
    public static final int BACKGROUND5=21;
    public static final int CANDADO=22;
    public static final int ABOUT_ICON_BACKGROUND=23;
    public static final int ICON_FRAME_MAIN=24;
    public static final int ICON_FRAME_MAIN_JPG=25;
    public static final int AUTOR=26;
    
    public static final int ICONPROD_LIBRARY1=101;
    public static final int ICONPROD_LIBRARY2=102;
    public static final int ICONPROD_LIBRARY3=103;
    public static final int ICONPROD_LIBRARY4=104;
    public static final int ICONPROD_LIBRARY5=105;
    public static final int ICONPROD_LIBRARY6=106;
    public static final int ICONPROD_LIBRARY7=107;
    public static final int ICONPROD_LIBRARY8=108;
    
    public static final int INITIAL_ID_ICON_USER=500;
    public static final int MAX_IMAGES=109;
    public static String[] pathResources=new String[MAX_IMAGES];
    public static ImageIcon[] images=new ImageIcon[MAX_IMAGES];
    static{
    	try {
			Class.forName("inc.jmc.cyberboard.common.PictLienzoJM");
		} catch (ClassNotFoundException e) {
			e.printStackTrace();
		}
        
		pathResources[COMPUTER_ICON_FRAME]="/inc/jmc/computericonframe.jpg";
        pathResources[PC_DISPONIBLE]="/inc/jmc/pcdisponible.jpg";
        pathResources[PC_FUERA_DE_SERVICIO]="/inc/jmc/pcfueraservicio.jpg";
        pathResources[PC_OCUPADA]="/inc/jmc/pcocupada.jpg";
        pathResources[PC_APAGADA]="/inc/jmc/pcapagada.jpg";
        pathResources[PC_ICONIFICADA]="/inc/jmc/computericonified.jpg";
        pathResources[PESOS_ICON]="/inc/jmc/pesosicono.jpg";
        pathResources[JPG_FILTER]="/inc/jmc/jpgicon.jpg";
        pathResources[JPG_FILTER2]="/inc/jmc/jpgicon2.jpg";
        pathResources[GIF_FILTER]="/inc/jmc/gifIcon.gif";
        pathResources[CARATULA_RELOJ]="/inc/jmc/relojcaratula.jpg";
        pathResources[MAIN_COVER]="/inc/jmc/maincover.jpg";
        pathResources[BUTTON_START]="/inc/jmc/buttonstart.jpg";
        pathResources[BUTTON_STOP]="/inc/jmc/buttonstop.jpg";
        pathResources[VISTA_TABLA]="/inc/jmc/vista_tabla.jpg";
        pathResources[VISTA_LISTA]="/inc/jmc/vista_lista.jpg";
        pathResources[VISTA_ICONOS]="/inc/jmc/vista_iconos.jpg";
        pathResources[BACKGROUND1]="/inc/jmc/background.jpg";
        pathResources[CANDADO]="/inc/jmc/candado5.jpg";
        pathResources[ABOUT_ICON_BACKGROUND]="/inc/jmc/maincovercliente.jpg";
        pathResources[ICON_FRAME_MAIN]="/inc/jmc/mainicono.gif";
        pathResources[ICON_FRAME_MAIN_JPG]="/inc/jmc/mainicono.jpg";
        pathResources[AUTOR]="/inc/jmc/autor.jpg";
        
        pathResources[ICONPROD_LIBRARY1]="/inc/jmc/iconoproducto1.jpg";
        pathResources[ICONPROD_LIBRARY2]="/inc/jmc/iconoproducto2.jpg";
        pathResources[ICONPROD_LIBRARY3]="/inc/jmc/iconoproducto3.jpg";
        pathResources[ICONPROD_LIBRARY4]="/inc/jmc/iconoproducto4.jpg";
        pathResources[ICONPROD_LIBRARY5]="/inc/jmc/iconoproducto5.jpg";
        pathResources[ICONPROD_LIBRARY6]="/inc/jmc/iconoproducto6.jpg";
        pathResources[ICONPROD_LIBRARY7]="/inc/jmc/iconoproducto7.jpg";
        pathResources[ICONPROD_LIBRARY8]="/inc/jmc/iconoproducto8.jpg";
        
		
    	
        images[COMPUTER_ICON_FRAME]=new ImageIcon(ImageLoader.class.getResource(pathResources[COMPUTER_ICON_FRAME]));
        images[PC_DISPONIBLE]=new ImageIcon(ImageLoader.class.getResource(pathResources[PC_DISPONIBLE]));
        images[PC_FUERA_DE_SERVICIO]=new ImageIcon(ImageLoader.class.getResource(pathResources[PC_FUERA_DE_SERVICIO]));
        images[PC_OCUPADA]=new ImageIcon(ImageLoader.class.getResource(pathResources[PC_OCUPADA]));
        images[PC_APAGADA]=new ImageIcon(ImageLoader.class.getResource(pathResources[PC_APAGADA]));
        images[PC_ICONIFICADA]=new ImageIcon(ImageLoader.class.getResource(pathResources[PC_ICONIFICADA]));
        images[PESOS_ICON]=new ImageIcon(ImageLoader.class.getResource(pathResources[PESOS_ICON]));
        images[JPG_FILTER]=new ImageIcon(ImageLoader.class.getResource(pathResources[JPG_FILTER]));
        images[JPG_FILTER2]=new ImageIcon(ImageLoader.class.getResource(pathResources[JPG_FILTER2]));
        images[GIF_FILTER]=new ImageIcon(ImageLoader.class.getResource(pathResources[GIF_FILTER]));
        images[CARATULA_RELOJ]=new ImageIcon(ImageLoader.class.getResource(pathResources[CARATULA_RELOJ]));
        images[MAIN_COVER]=new ImageIcon(ImageLoader.class.getResource(pathResources[MAIN_COVER]));
        images[BUTTON_START]=new ImageIcon(ImageLoader.class.getResource(pathResources[BUTTON_START]));
        images[BUTTON_STOP]=new ImageIcon(ImageLoader.class.getResource(pathResources[BUTTON_STOP]));
        images[VISTA_TABLA]=new ImageIcon(ImageLoader.class.getResource(pathResources[VISTA_TABLA]));
        images[VISTA_LISTA]=new ImageIcon(ImageLoader.class.getResource(pathResources[VISTA_LISTA]));
        images[VISTA_ICONOS]=new ImageIcon(ImageLoader.class.getResource(pathResources[VISTA_ICONOS]));
        images[BACKGROUND1]=new ImageIcon(ImageLoader.class.getResource(pathResources[BACKGROUND1]));
        images[CANDADO]=new ImageIcon(ImageLoader.class.getResource(pathResources[CANDADO]));
        images[ABOUT_ICON_BACKGROUND]=new ImageIcon(ImageLoader.class.getResource(pathResources[ABOUT_ICON_BACKGROUND]));
        images[ICON_FRAME_MAIN]=new ImageIcon(ImageLoader.class.getResource(pathResources[ICON_FRAME_MAIN]));
        images[ICON_FRAME_MAIN_JPG]=new ImageIcon(ImageLoader.class.getResource(pathResources[ICON_FRAME_MAIN_JPG]));
        images[AUTOR]=new ImageIcon(ImageLoader.class.getResource(pathResources[AUTOR]));
        
        images[ICONPROD_LIBRARY1]=new ImageIcon(ImageLoader.class.getResource(pathResources[ICONPROD_LIBRARY1]));
        images[ICONPROD_LIBRARY2]=new ImageIcon(ImageLoader.class.getResource(pathResources[ICONPROD_LIBRARY2]));
        images[ICONPROD_LIBRARY3]=new ImageIcon(ImageLoader.class.getResource(pathResources[ICONPROD_LIBRARY3]));
        images[ICONPROD_LIBRARY4]=new ImageIcon(ImageLoader.class.getResource(pathResources[ICONPROD_LIBRARY4]));
        images[ICONPROD_LIBRARY5]=new ImageIcon(ImageLoader.class.getResource(pathResources[ICONPROD_LIBRARY5]));
        images[ICONPROD_LIBRARY6]=new ImageIcon(ImageLoader.class.getResource(pathResources[ICONPROD_LIBRARY6]));
        images[ICONPROD_LIBRARY7]=new ImageIcon(ImageLoader.class.getResource(pathResources[ICONPROD_LIBRARY7]));
        images[ICONPROD_LIBRARY8]=new ImageIcon(ImageLoader.class.getResource(pathResources[ICONPROD_LIBRARY8]));
        
        
        
        
    }
    /**
     * Este metodo identifica ,el id de la imagen por la cual se pregunta.
     * Si esta imagen se encuentra entre las imagenes que el sistema tiene, entonces, se regresa el id 
     * con el cual es identidicado en el sistema. si la imagen por la que estamos preguntando, no se encuentra,
     * entonces retornamos un -1
     * @param img imagen por la cual se esta preguntando, si esta entre las imagenes del sistema
     * @return regresa -1 en caso de que no exista esa image dentro de las imagenes reservadas del sistema.<BR>
     * regresa un numero entero en caso de que si sea identificada esta imagen
     */
    public static int getIdIcon(ImageIcon img)
    {
        int ret=-1;
        for(int i=0;i<images.length;++i)
        {
            if(images[i]==img)
            {
                ret=i;
            }
        
        }
        return ret;
        
    
    
    }
}
